﻿using System;
using System.Collections.Generic;
using System.Data.Linq;
using System.Data.Linq.Mapping;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Phone.Data.Linq.Mapping;

/**
 * 创建时间：2014/12/18 14:43:45
 * 作者：yong.blackcore
 * Email：itblackhole@outlook.com
 * QQ：50404503
 */
namespace ComicIsland.Common.Entities
{
    [Table]
    [Index(Columns = "ComicId ASC, PartId DESC", Name = "MyIndex")]
    public class TableDownloadComic
    {
        // 版本列，可以显著改进表的更新性能
        [Column(IsVersion = true)]
        private Binary _version;

        [Column(DbType = "INT NOT NULL IDENTITY", IsDbGenerated = true, IsPrimaryKey = true)]
        public int Id { get; set; }

        [Column]
        public string ComicIdAndPartId { get; set; }


        #region 漫画
        [Column]
        public int ComicId { get; set; }
        [Column]
        public string ComicTitle { get; set; }
        [Column]
        public string CoverUrl { get; set; }
        [Column]
        public string DownloadStatusComic { get; set; }
        #endregion 漫画


        #region 漫画中的章节
        [Column]
        public string Sourceparturl { get; set; }
        [Column]
        public string Msourceparturl { get; set; }
        [Column]
        public double Partsize { get; set; }
        [Column]
        public int PartId { get; set; }
        [Column]
        public int Partnumber { get; set; }
        [Column]
        public string Name { get; set; }
        [Column]
        public int Totalpage { get; set; }
        [Column]
        public string DownloadStatusComicChapter { get; set; }
        #endregion 漫画中的章节


        #region 漫画中的章节的图片地址
        [Column]
        public string Referer { get; set; }
        [Column]
        public string ImageUrl { get; set; }
        [Column]
        public string DownloadStatusComicChapterImage { get; set; }
        #endregion 漫画中的章节的图片地址


        public override string ToString()
        {
            StringBuilder content = new StringBuilder();
            content.Append(string.Concat("_version",":", this._version, ","));
            content.Append(string.Concat("Id", ":", this.Id, ","));
            content.Append(string.Concat("ComicIdAndPartId", ":", this.ComicIdAndPartId, ","));
            //
            content.Append(string.Concat("ComicId", ":", this.ComicId, ","));
            content.Append(string.Concat("ComicTitle", ":", this.ComicTitle, ","));
            content.Append(string.Concat("CoverUrl", ":", this.CoverUrl, ","));
            content.Append(string.Concat("DownloadStatusComic", ":", this.DownloadStatusComic, ","));
            //
            content.Append(string.Concat("PartId", ":", this.PartId, ","));
            content.Append(string.Concat("Partnumber", ":", this.Partnumber, ","));
            content.Append(string.Concat("Partsize", ":", this.Partsize, ","));
            content.Append(string.Concat("Name", ":", this.Name, ","));
            content.Append(string.Concat("Msourceparturl", ":", this.Msourceparturl, ","));
            content.Append(string.Concat("Sourceparturl", ":", this.Sourceparturl, ","));
            content.Append(string.Concat("Totalpage", ":", this.Totalpage, ","));
            content.Append(string.Concat("DownloadStatusComicChapter", ":", this.DownloadStatusComicChapter, ","));
            //
            content.Append(string.Concat("Referer", ":", this.Referer, ","));
            content.Append(string.Concat("ImageUrl", ":", this.ImageUrl, ","));
            content.Append(string.Concat("DownloadStatusComicChapterImage", ":", this.DownloadStatusComicChapterImage));
            //            
            return content.ToString();
        }

    }
}
